package com.id;

import cn.hutool.core.util.IdUtil;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.springframework.beans.factory.annotation.Value;

import java.io.Serializable;

public class MyID implements  org.hibernate.id.IdentifierGenerator {

    //@Value("${DataBaseID}")
  // private  Integer id;

    @Override
    public Serializable generate(SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws HibernateException {
        Long id = IdUtil.getSnowflake(1,1).nextId();
        //Order2020021300001
        return id;
    }
}
